using System;
using System.Windows;
namespace Microsoft.Expression.Interactivity.Core
{
	public class ComparisonCondition : DependencyObject
	{
		public static readonly DependencyProperty LeftOperandProperty = DependencyProperty.Register("LeftOperand", typeof(object), typeof(ComparisonCondition), new PropertyMetadata(null));
		public static readonly DependencyProperty OperatorProperty = DependencyProperty.Register("Operator", typeof(ComparisonConditionType), typeof(ComparisonCondition), new PropertyMetadata(ComparisonConditionType.Equal));
		public static readonly DependencyProperty RightOperandProperty = DependencyProperty.Register("RightOperand", typeof(object), typeof(ComparisonCondition), new PropertyMetadata(null));
		public object LeftOperand
		{
			get
			{
				return base.GetValue(ComparisonCondition.LeftOperandProperty);
			}
			set
			{
				base.SetValue(ComparisonCondition.LeftOperandProperty, value);
			}
		}
		public object RightOperand
		{
			get
			{
				return base.GetValue(ComparisonCondition.RightOperandProperty);
			}
			set
			{
				base.SetValue(ComparisonCondition.RightOperandProperty, value);
			}
		}
		public ComparisonConditionType Operator
		{
			get
			{
				return (ComparisonConditionType)base.GetValue(ComparisonCondition.OperatorProperty);
			}
			set
			{
				base.SetValue(ComparisonCondition.OperatorProperty, value);
			}
		}
		public bool Evaluate()
		{
			this.EnsureBindingUpToDate();
			return ComparisonLogic.EvaluateImpl(this.LeftOperand, this.Operator, this.RightOperand);
		}
		private void EnsureBindingUpToDate()
		{
			DataBindingHelper.EnsureBindingUpToDate(this, ComparisonCondition.LeftOperandProperty);
			DataBindingHelper.EnsureBindingUpToDate(this, ComparisonCondition.OperatorProperty);
			DataBindingHelper.EnsureBindingUpToDate(this, ComparisonCondition.RightOperandProperty);
		}
	}
}
